<template>
	<!-- 账户安全 -->
	<view class="content">
		<view class="item" @click="toChangePhoneNum">
			<span>更改绑定手机号</span>
			<view class="right">
				<span>{{phoneNum?'已绑定:'+phoneNum:'未绑定手机号'}}</span>
				<image src="/static/img/my_slices/Frame222@2x.png" mode="scaleToFill"></image>
			</view>
		</view>
		<view class="item" @click="tochangePassword">
			<span>更改密码</span>
			<view class="right">
				<span>{{alreadySetPwd?'******':''}}</span>
				<image src="/static/img/my_slices/Frame222@2x.png" mode="scaleToFill"></image>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				phoneNum:'',
				alreadySetPwd:false,
			}
		},
		onLoad() {
			this.$store.dispatch('initDic').then(()=>{
				this.$http.request({
					url:'/user/securityManage',
					data:{
						type:0
					}
				}).then(result=>{
					let res=result.data
					console.log(res);
					this.phoneNum=res.data.mobile
					this.alreadySetPwd=res.data.alreadySetPwd
				})
			})
			
		},
		methods: {
			toChangePhoneNum(){
				//前往更换手机号
				uni.navigateTo({
					url:'./changePhoneNum'
				})
			},
			//前往设置/修改密码
			tochangePassword(){
				uni.navigateTo({
					url:'./changePassword?alreadySetPwd='+this.alreadySetPwd+"&mobile="+this.phoneNum
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.content{
		width: 100%;
		min-height: 100vh;
		padding: 1px 0;
		background-color: #F3F7F8;
		
		.item{
			padding: 32rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			border-bottom: 1px solid #F5F5F5;
			background-color: #FFFFFF;
			>span{
				font-size: 28rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				color: #001A18;
			}
			.right{
				display: flex;
				align-items: center;
				>span{
					font-size: 28rpx;
					font-family: PingFang SC-Regular, PingFang SC;
					font-weight: 400;
					color: #505E5C;
					margin-right: 10rpx;
				}
				>image{
					width: 16rpx;
					height: 30rpx;
				}
			}
			
		}
	}
</style>
